package com.cyh.ebptasywar.trigger;

import com.cyh.ebptasywar.common.config.JobDetailConfig;
import com.cyh.ebptasywar.job.PromptWorkJob;
import org.quartz.CronScheduleBuilder;
import org.quartz.CronTrigger;
import org.quartz.JobBuilder;
import org.quartz.JobDetail;
import org.quartz.SimpleScheduleBuilder;
import org.quartz.Trigger;
import org.quartz.TriggerBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.DependsOn;
import org.springframework.stereotype.Component;

/**
 * Scheduler来调度Trigger和JobDetil
 * JobDetail来实例化Job类并可以传值
 * @author theone
 */
@Configuration
public class PromtWorkTrigger extends BaseTrigger {

    @Bean(name = "PromtWorkTrigger")
    public Trigger CronTrigger(){
        // TODO 根据配置来配置
        CronTrigger trigger = TriggerBuilder.newTrigger().withIdentity("PromtWork","ebptasy").withSchedule(CronScheduleBuilder.cronSchedule("0/6 * * * * ?")).build();
        return trigger;
    }
}